package com.yc.springcloud.controller;

import com.yc.springcloud.service.AccountService;
import com.yc.springcloud.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @Author DELL
 * @Date 2024/11/20 16:21
 * @Version 1.0
 */
@Slf4j
@Controller
public class AccountController {

	@Resource
	public AccountService accountService;

	/**
	 * 扣减账户余额
	 */
	@PostMapping(value = "/account/reduce")
	@ResponseBody
	public Result reduce(@RequestParam("userId") Long userId, @RequestParam("money") Integer money){
		log.info("====AccountController reduce start====");
		accountService.reduce(userId,money);
		return Result.success("200", "扣减账户余额 OK");
	}
}



